<template>
  <div class="error-page">
    <div class="error-container">
      <h1>500 - <span>Server Error</span></h1>
      <img class="minecraft-icon" src="@/assets/brick.png" alt="Lava Bucket">
      <p>Our blockchain node is experiencing issues. Please try again later.</p>
      <div class="button-group">
        <button class="primary" @click="reload">Retry</button>
        <button class="secondary" @click="goHome">Go Home</button>
      </div>
      <div class="status">
        <p>Node Status: <span class="offline">Offline</span></p>
        <p>Last Block: #{{ lastBlock }}</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const lastBlock = ref('12,345,678')

const reload = () => {
  window.location.reload()
}

const goHome = () => {
  router.push('/')
}
</script>

<style scoped>
/* 基础重置 */
html, body, #app {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

.error-page {
  /* 视口设置 */
  height: 100vh;
  width: 100vw;
  overflow-y: auto;

  /* 布局设置 */
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #0a0a0a;
  color: white;
  font-family: Arial, sans-serif;
  padding: 20px;
  box-sizing: border-box;
}

.error-container {
  /* 内容容器 */
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  padding: 40px 20px;
}

h1 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(90deg, #ff4444, #ffaa44);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p {
  font-size: 1.1rem;
  color: #aaa;
  margin: 0;
  max-width: 600px;
}

.minecraft-icon {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(255, 68, 68, 0.5));
  animation: pulse 2s infinite;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

button {
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.primary {
  background: linear-gradient(90deg, #ff4444, #ffaa44);
  color: #0a0a0a;
}

.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 68, 68, 0.3);
}

.secondary {
  background: transparent;
  color: #ff4444;
  border: 1px solid #ff4444;
}

.secondary:hover {
  background: rgba(255, 68, 68, 0.1);
}

.status {
  font-size: 1rem;
  color: #aaa;
  margin-top: 1rem;
}

.status p {
  margin: 0.5rem 0;
}

.offline {
  color: #ff4444;
  font-weight: bold;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* 响应式调整 */
@media (max-height: 700px) {
  .error-container {
    padding: 20px;
    gap: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .minecraft-icon {
    width: 120px;
    height: 120px;
  }
}
</style>